// @ts-nocheck
import router from '@system.router';
export default {
    data: {
        title: 'World'
    },
    pushRouter(){
        router.push({
            uri: 'pages/jsBasic/routerTest/routerTest',
            params: {
                data1: 'message',
            },
        });
    },
    replaceRouter(){
        router.replace({
            uri: 'pages/jsBasic/routerTest/routerTest',
            params: {
                data1: 'message',
            },
        });
    },
    backRouter(){
        // 通过back，将返回index页面
        router.back();
//        // detail页面通过back，将返回index页面
//        router.back();
//        // 通过back，返回到detail页面
//        router.back({uri:'pages/detail/detail'});
    },
    clearRouter(){
        router.clear();
    },
    getState(){
        var page = router.getState();
        console.log('current index = ' + page.index);
        console.log('current name = ' + page.name);
        console.log('current path = ' + page.path);
    },
    getLength(){
        var size = router.getLength();
        console.log('pages stack size = ' + size);
    },
    enableAlertBeforeBackPage(){
        console.log(111)
        router.enableAlertBeforeBackPage({
            message: 'Message Info',
            success: function() {
                console.log('success');
            },
            fail: function() {
                console.log('fail');
            },
        });
    },
    disableAlertBeforeBackPage(){
// @ts-ignore
        router.disableAlertBeforeBackPage({
            success: function() {
                console.log('success');
            },
            fail: function() {
                console.log('fail');
            },
        });
    }
}
